<template>
	<view class="news">
		<news-list  @itemClick="getDetail($event)"  :list="newsList"></news-list>
	</view>
</template>

<script>
	import newsList from '../../components/news-list/news-list.vue'
	export default {
		data() {
			return {
				newsList:[]
			}
		},
		methods: {
			async getNews (){
				const res = await this.$myRequest({
					url: '/api/getnewslist'
				})
				// console.log(res)
				this.newsList = res.data.message
			},
			getDetail(id){
				uni.navigateTo({
					url: '/pages/news-detail/news-detail?id='+id
				})
			}
		},
		onLoad(){
			this.getNews()
		},
		components:{'news-list': newsList}
	}
</script>

<style lang="scss">
 .news{
	
	 
 }
</style>
